/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AdminLogin.java
 *
 * Created on 11 2, 11, 1:53:38 PM
 */

/**
 *
 * @author kylle
 */

import javax.swing.JOptionPane;

public class AdminLogin extends javax.swing.JFrame {


    /** Creates new form AdminLogin */
    public AdminLogin() {
        initComponents();
        this.setBounds(550, 100, 250, 250);
        this.setTitle("Administrator Log-in");
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        adminIDLogin_text = new javax.swing.JTextField();
        adminLoginBtn = new javax.swing.JButton();
        adminPassLogin_text = new javax.swing.JPasswordField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBounds(new java.awt.Rectangle(500, 100, 400, 500));
        setResizable(false);

        jLabel1.setText("Admin Login");

        jLabel2.setText("Admin ID:");

        jLabel3.setText("Password");

        adminIDLogin_text.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                adminIDLogin_textActionPerformed(evt);
            }
        });

        adminLoginBtn.setText("Login");
        adminLoginBtn.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                adminLoginBtnMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(89, 89, 89)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(32, 32, 32)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel3))
                                .addGap(27, 27, 27)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(adminPassLogin_text, 0, 0, Short.MAX_VALUE)
                                    .addComponent(adminIDLogin_text, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(62, 62, 62)
                                .addComponent(adminLoginBtn)))))
                .addGap(227, 227, 227))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jLabel1)
                .addGap(32, 32, 32)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(adminIDLogin_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(adminPassLogin_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(36, 36, 36)
                .addComponent(adminLoginBtn)
                .addContainerGap(223, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void adminIDLogin_textActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_adminIDLogin_textActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_adminIDLogin_textActionPerformed

    private void adminLoginBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_adminLoginBtnMouseClicked
        if(adminIDLogin_text.getText().equals("AD1000") && adminPassLogin_text.getText().equals("1234"))
        {
            new AdminScreen2().setVisible(true);
            this.setVisible(false);
        }

        else if(adminIDLogin_text.getText().equals("") || adminPassLogin_text.getText().equals(""))
            JOptionPane.showMessageDialog(null,"No ID or Password input","Error", JOptionPane.WARNING_MESSAGE);

        else{
           JOptionPane.showMessageDialog(null,"Invalid ID and/or Password","Error", JOptionPane.WARNING_MESSAGE);
        }
    }//GEN-LAST:event_adminLoginBtnMouseClicked

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new AdminLogin().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField adminIDLogin_text;
    private javax.swing.JButton adminLoginBtn;
    private javax.swing.JPasswordField adminPassLogin_text;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    // End of variables declaration//GEN-END:variables

}
